#include <iostream>
#include <vector>
#include <unordered_map>

class Device {};

class DeviceManger{
private:
    std::unordered_map<std::string, std::vector<Device*>> m_Devices;
public:
    const std::unordered_map<std::string, std::vector<Device*>>& GetDevices()
    {
        return m_Devices;
    }
};

class Test {
public:
     int num;
};

int func_int() {}
int& func_int_r() {}
int&& func_int_rr() {}
const int func_cint() {}
const int& func_cint_r() {}
const int&& func_cint_rr() {}
const Test func_ctest() {}


int main()
{
    const Test obj;
    decltype(obj.num) b = 90;
    decltype((obj.num)) c = b;
    int n = 0, m = 0;
    decltype(n + m) c = 0;
    decltype(n = n + m) d = n;

    int n = 100;
    // a : int
    decltype(func_int()) a = 0;
    // b : int&
    decltype(func_int_r()) b = n;
    // c: int&&
    decltype(func_int_rr()) c = 0;
    // d: int
    decltype(func_cint()) d = 0;
    // e: const int&
    decltype(func_cint_r()) e = n;
    // f: const int&&
    decltype(func_cint_rr()) f = 0;
    // g: const Test
    decltype(func_ctest()) g = Test();


    // auto x = 3.14;
    // auto y = 520;
    // auto z = 'c';
    // auto&& rvalueRef = 20; // rvalueRef 是 int&& 类型，绑定到右值 20
    // int temp = 110;
    // auto* a = &temp;
    // auto aa = &temp;
    
    // auto& b = temp; // 等价于 int& y = temp;
    // auto c = b;
   
    // //a1 :const int
    // const auto a1 = temp;
    // // a2 : int
    // auto a2 = a1;
    // // a3: const int&
    // const auto& a3 = temp;
    // // a4: const int&
    // auto& a4 = a3;
    // // pt5 : const int *
    // auto* pt4 = &a1;
 
  
    // decltype
    int x = 99;
    const int & y = x;
    // a : int
    decltype(x) a = x;
    // a2 : int&
    decltype((x)) a2 = x;

    // b : const int & 
    // y : const int &
    decltype(y) b = x;

    std::vector<std::string> strings;
    strings.emplace_back("Apple");
    strings.emplace_back("orange");

    // for(std::vector<std::string>::iterator it = strings.begin(); it != strings.end(); it++)
    for(auto it = strings.begin(); it != strings.end(); it++)
    {
        std::cout << *it << std::endl;
    }
 
    DeviceManger dm;
    //const std::unordered_map<std::string, std::vector<Device*>>& devices = dm.GetDevices();
     const auto& devices = dm.GetDevices();
}